package com.vision.controller;

import com.vision.pojo.AjaxResult;
import com.vision.service.LikeCommentService;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @projectName: vision
 * @package: com.vision.controller
 * @className: LikeCommentController
 * @author: escapeicon@gmail.com
 * @description: 点赞评论控制器
 * @date: 2024/1/29 8:56
 * @version: 1.0
 */
@RestController
@RequestMapping("/likeComment")
public class LikeCommentController {
    @Autowired
    private LikeCommentService likeCommentService;

    /**
     * 添加点赞评论
     * @param commentId 评论ID
     * @return AjaxResult
     */
    @PostMapping("/addLikeComment")
    public AjaxResult addLikeComment(@NotNull Integer commentId){
        likeCommentService.addLikeComment(commentId);
        return AjaxResult.success();
    }

    /**
     * 删除点赞评论
     * @param commentId 评论ID
     * @return AjaxResult
     */
    @DeleteMapping("/cancelLikeComment")
    public AjaxResult cancelLikeComment(@NotNull Integer commentId){
        likeCommentService.cancelLikeComment(commentId);
        return AjaxResult.success();
    }
}
